#ifndef MODELINFOSTATE
#define MODELINFOSTATE

#include <base\vec2i.h>
#include <app\states\sessionState.h>

#include <Poco\File.h>

#include <string>
#include <fstream>
#include <sstream>
#include <iostream>

using namespace std;

struct sModelInfo {
  vec2i tex_tile_size;
  vec2i tex_levels_interval;
  int   tex_level0_offset;

  vec2i traj_tile_size;
  vec2i traj_levels_interval;
  int   traj_level0_offset;

  vec2i terr_tile_size;
  vec2i terr_levels_interval;
  int   terr_level0_offset;

  sModelInfo() : tex_level0_offset(0), traj_level0_offset(0), terr_level0_offset(0) {
  };
};

class modelInfoState : public sessionState {

  static int class_type_id;
  int type_id;

  sModelInfo modelInfo;

  bool received; ///< flag indicate if the model info was received from server and set up

public:

  static sessionState *create();

  void loadInfo(Poco::File file);
  void saveInfo(Poco::File file);

  void loadFromRawData(unsigned char *data, int size);
  unsigned char *getRawData(int &size);

  void setModelInfoReceived(bool value);
  bool modelInfoReceived();

  sModelInfo info();

  static int getClassTypeId();
  virtual int getTypeId();

  modelInfoState();
  virtual ~modelInfoState();
};

#endif